#pragma once
#include <memory>
#include <string>
#include <cstddef>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <odb/nullable.hxx>
#include <odb/core.hxx>


namespace entity {

#pragma db object table("friend_apply")
class FriendApply
{
public:
    FriendApply() {}
    FriendApply(const std::string& eventId, const std::string& reqId, const std::string& recvId)
        : eventId_(eventId), requesterId_(reqId), receiverId_(recvId) {}

    void seteventId(const std::string& val) { eventId_ = val; }
    std::string eventId() const { return eventId_; }

    void setRequesterId(const std::string& val) { requesterId_ = val; }
    std::string requesterId() const { return requesterId_; }

    void setReceiverId(const std::string& val) { receiverId_ = val; }
    std::string receiverId() const { return receiverId_; }

private:
    friend class odb::access; 
    
    #pragma db id auto
    uint32_t id_;

    #pragma db column("event_id") type("varchar(32)") index unique
    std::string eventId_;

    #pragma db column("requester_id") type("varchar(32)") index
    std::string requesterId_;    // 发起申请者用户ID

    #pragma db column("receiver_id") type("varchar(32)") index
    std::string receiverId_;     // 被申请者用户ID
};

using FriendApplyPtr = std::shared_ptr<FriendApply>;

}

// odb -d mysql --std c++11 --generate-query --generate-schema --profile boost/date-time friend_apply.hxx
